﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using DBUtility;//请先添加引用
using System.Data;
namespace Web.Views.AgentManager
{
    public partial class foundStatistics : System.Web.UI.Page
    {
        public int AgentID = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            //GetTradeDatasource();
            GridView1.DataSourceID = "ObjectDataSource1";
            GridView1.DataBind();
            if (!IsPostBack)
            {
                AgentID = Easydp.Controllers.AgentController.AgentInfo.AgentID;
            }
        }

        //public void GetTradeDatasource()
        //{
        //    Easydp.Controllers.TradeController bll = new Easydp.Controllers.TradeController();
        //    GridView1.DataSource = bll.GetDataDource(AgentID, "", "yyyy-mm-dd", "yyyy-mm-dd");
        //    GridView1.DataBind();
           
        //}

        protected void BtnSelect_Click(object sender, EventArgs e)
        {
            
            GridView1.DataBind();
        }
      
        decimal mysum1 = 0;
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            
            

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataRowView myrows = (DataRowView)e.Row.DataItem;
                mysum1 += Convert.ToDecimal(myrows[4].ToString());
                //spanSum.InnerText = mysum1.ToString();
               
               
            }

            // 合计
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                e.Row.Cells[3].Text = "合计";
                e.Row.Cells[4].Text = mysum1.ToString();
             
            }

        }
       

       
    }
}
